{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<a href=\"https://colab.research.google.com/github/jerryjliu/llama_index/blob/main/docs/examples/query_engine/knowledge_graph_rag_query_engine.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Knowledge Graph RAG Query Engine\n",
    "\n",
    "\n",
    "## Graph RAG\n",
    "\n",
    "Graph RAG is an Knowledge-enabled RAG approach to retrieve information from Knowledge Graph on given task. Typically, this is to build context based on entities' SubGraph related to the task.\n",
    "\n",
    "## GraphStore backed RAG vs VectorStore RAG\n",
    "\n",
    "As we compared how Graph RAG helps in some use cases in [this tutorial](https://gpt-index.readthedocs.io/en/latest/examples/index_structs/knowledge_graph/KnowledgeGraphIndex_vs_VectorStoreIndex_vs_CustomIndex_combined.html#id1), it's shown Knowledge Graph as the unique format of information could mitigate several issues caused by the nature of the \"split and embedding\" RAG approach.\n",
    "\n",
    "## Why Knowledge Graph RAG Query Engine\n",
    "\n",
    "In Llama Index, there are two scenarios we could apply Graph RAG:\n",
    "\n",
    "- Build Knowledge Graph from documents with Llama Index, with LLM or even [local models](https://colab.research.google.com/drive/1G6pcR0pXvSkdMQlAK_P-IrYgo-_staxd?usp=sharing), to do this, we should go for `KnowledgeGraphIndex`.\n",
    "- Leveraging existing Knowledge Graph, in this case, we should use `KnowledgeGraphRAGQueryEngine`.\n",
    "\n",
    "> Note, the third query engine that's related to KG in Llama Index is `NL2GraphQuery` or `Text2Cypher`, for either exiting KG or not, it could be done with `KnowledgeGraphQueryEngine`."
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Before we start the `Knowledge Graph RAG QueryEngine` demo, let's first get ready for basic preparation of Llama Index."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "%pip install llama-index-llms-azure-openai\n",
    "%pip install llama-index-graph-stores-nebula\n",
    "%pip install llama-index-llms-openai\n",
    "%pip install llama-index-embeddings-azure-openai"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "!pip install llama-index"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### OpenAI"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# For OpenAI\n",
    "\n",
    "import os\n",
    "\n",
    "os.environ[\"OPENAI_API_KEY\"] = \"sk-...\"\n",
    "\n",
    "import logging\n",
    "import sys\n",
    "\n",
    "logging.basicConfig(\n",
    "    stream=sys.stdout, level=logging.INFO\n",
    ")  # logging.DEBUG for more verbose output\n",
    "\n",
    "\n",
    "# define LLM\n",
    "from llama_index.llms.openai import OpenAI\n",
    "from llama_index.core import Settings\n",
    "\n",
    "Settings.llm = OpenAI(temperature=0, model=\"gpt-3.5-turbo\")\n",
    "Settings.chunk_size = 512"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Azure"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from llama_index.llms.azure_openai import AzureOpenAI\n",
    "from llama_index.embeddings.azure_openai import AzureOpenAIEmbedding\n",
    "\n",
    "# For Azure OpenAI\n",
    "api_key = \"<api-key>\"\n",
    "azure_endpoint = \"https://<your-resource-name>.openai.azure.com/\"\n",
    "api_version = \"2023-07-01-preview\"\n",
    "\n",
    "llm = AzureOpenAI(\n",
    "    model=\"gpt-35-turbo-16k\",\n",
    "    deployment_name=\"my-custom-llm\",\n",
    "    api_key=api_key,\n",
    "    azure_endpoint=azure_endpoint,\n",
    "    api_version=api_version,\n",
    ")\n",
    "\n",
    "# You need to deploy your own embedding model as well as your own chat completion model\n",
    "embed_model = AzureOpenAIEmbedding(\n",
    "    model=\"text-embedding-ada-002\",\n",
    "    deployment_name=\"my-custom-embedding\",\n",
    "    api_key=api_key,\n",
    "    azure_endpoint=azure_endpoint,\n",
    "    api_version=api_version,\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from llama_index.core import Settings\n",
    "\n",
    "Settings.llm = llm\n",
    "Settings.embed_model = embed_model\n",
    "Settings.chunk_size = 512"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Prepare for NebulaGraph\n",
    "\n",
    "We take [NebulaGraphStore](https://gpt-index.readthedocs.io/en/stable/examples/index_structs/knowledge_graph/NebulaGraphKGIndexDemo.html) as an example in this demo, thus before next step to perform Graph RAG on existing KG, let's ensure we have a running NebulaGraph with defined data schema.\n",
    "\n",
    "This step installs the clients of NebulaGraph, and prepare contexts that defines a [NebulaGraph Graph Space](https://docs.nebula-graph.io/3.6.0/1.introduction/2.data-model/)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Requirement already satisfied: ipython-ngql in /Users/loganmarkewich/llama_index/llama-index/lib/python3.9/site-packages (0.5)\n",
      "Requirement already satisfied: nebula3-python in /Users/loganmarkewich/llama_index/llama-index/lib/python3.9/site-packages (3.4.0)\n",
      "Requirement already satisfied: Jinja2 in /Users/loganmarkewich/llama_index/llama-index/lib/python3.9/site-packages (from ipython-ngql) (3.1.2)\n",
      "Requirement already satisfied: pandas in /Users/loganmarkewich/llama_index/llama-index/lib/python3.9/site-packages (from ipython-ngql) (2.0.3)\n",
      "Requirement already satisfied: httplib2>=0.20.0 in /Users/loganmarkewich/llama_index/llama-index/lib/python3.9/site-packages (from nebula3-python) (0.22.0)\n",
      "Requirement already satisfied: six>=1.16.0 in /Users/loganmarkewich/llama_index/llama-index/lib/python3.9/site-packages (from nebula3-python) (1.16.0)\n",
      "Requirement already satisfied: pytz>=2021.1 in /Users/loganmarkewich/llama_index/llama-index/lib/python3.9/site-packages (from nebula3-python) (2023.3)\n",
      "Requirement already satisfied: future>=0.18.0 in /Users/loganmarkewich/llama_index/llama-index/lib/python3.9/site-packages (from nebula3-python) (0.18.3)\n",
      "Requirement already satisfied: pyparsing!=3.0.0,!=3.0.1,!=3.0.2,!=3.0.3,<4,>=2.4.2 in /Users/loganmarkewich/llama_index/llama-index/lib/python3.9/site-packages (from httplib2>=0.20.0->nebula3-python) (3.0.9)\n",
      "Requirement already satisfied: MarkupSafe>=2.0 in /Users/loganmarkewich/llama_index/llama-index/lib/python3.9/site-packages (from Jinja2->ipython-ngql) (2.1.3)\n",
      "Requirement already satisfied: numpy>=1.20.3 in /Users/loganmarkewich/llama_index/llama-index/lib/python3.9/site-packages (from pandas->ipython-ngql) (1.25.2)\n",
      "Requirement already satisfied: tzdata>=2022.1 in /Users/loganmarkewich/llama_index/llama-index/lib/python3.9/site-packages (from pandas->ipython-ngql) (2023.3)\n",
      "Requirement already satisfied: python-dateutil>=2.8.2 in /Users/loganmarkewich/llama_index/llama-index/lib/python3.9/site-packages (from pandas->ipython-ngql) (2.8.2)\n",
      "\u001b[33mWARNING: You are using pip version 21.2.4; however, version 23.2.1 is available.\n",
      "You should consider upgrading via the '/Users/loganmarkewich/llama_index/llama-index/bin/python -m pip install --upgrade pip' command.\u001b[0m\n",
      "Note: you may need to restart the kernel to use updated packages.\n"
     ]
    }
   ],
   "source": [
    "# Create a NebulaGraph (version 3.5.0 or newer) cluster with:\n",
    "# Option 0 for machines with Docker: `curl -fsSL nebula-up.siwei.io/install.sh | bash`\n",
    "# Option 1 for Desktop: NebulaGraph Docker Extension https://hub.docker.com/extensions/weygu/nebulagraph-dd-ext\n",
    "\n",
    "# If not, create it with the following commands from NebulaGraph's console:\n",
    "# CREATE SPACE llamaindex(vid_type=FIXED_STRING(256), partition_num=1, replica_factor=1);\n",
    "# :sleep 10;\n",
    "# USE llamaindex;\n",
    "# CREATE TAG entity(name string);\n",
    "# CREATE EDGE relationship(relationship string);\n",
    "# :sleep 10;\n",
    "# CREATE TAG INDEX entity_index ON entity(name(256));\n",
    "\n",
    "%pip install ipython-ngql nebula3-python\n",
    "\n",
    "os.environ[\"NEBULA_USER\"] = \"root\"\n",
    "os.environ[\"NEBULA_PASSWORD\"] = \"nebula\"  # default is \"nebula\"\n",
    "os.environ[\n",
    "    \"NEBULA_ADDRESS\"\n",
    "] = \"127.0.0.1:9669\"  # assumed we have NebulaGraph installed locally\n",
    "\n",
    "space_name = \"llamaindex\"\n",
    "edge_types, rel_prop_names = [\"relationship\"], [\n",
    "    \"relationship\"\n",
    "]  # default, could be omit if create from an empty kg\n",
    "tags = [\"entity\"]  # default, could be omit if create from an empty kg"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Then we could instiatate a `NebulaGraphStore`, in order to create a `StorageContext`'s `graph_store` as it."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from llama_index.core import StorageContext\n",
    "from llama_index.graph_stores.nebula import NebulaGraphStore\n",
    "\n",
    "graph_store = NebulaGraphStore(\n",
    "    space_name=space_name,\n",
    "    edge_types=edge_types,\n",
    "    rel_prop_names=rel_prop_names,\n",
    "    tags=tags,\n",
    ")\n",
    "storage_context = StorageContext.from_defaults(graph_store=graph_store)"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Here, we assumed to have the same Knowledge Graph from [this turtorial](https://gpt-index.readthedocs.io/en/latest/examples/query_engine/knowledge_graph_query_engine.html#optional-build-the-knowledge-graph-with-llamaindex)"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Perform Graph RAG Query\n",
    "\n",
    "Finally, let's demo how to do Graph RAG towards an existing Knowledge Graph.\n",
    "\n",
    "All we need to do is to use `RetrieverQueryEngine` and configure the retriver of it to be `KnowledgeGraphRAGRetriever`.\n",
    "\n",
    "The `KnowledgeGraphRAGRetriever` performs the following steps:\n",
    "\n",
    "- Search related Entities of the quesion/task\n",
    "- Get SubGraph of those Entities (default 2-depth) from the KG\n",
    "- Build Context based on the SubGraph\n",
    "\n",
    "Please note, the way to Search related Entities could be either Keyword extraction based or Embedding based, which is controlled by argument `retriever_mode` of the `KnowledgeGraphRAGRetriever`, and supported options are:\n",
    "- \"keyword\"\n",
    "- \"embedding\"(not yet implemented)\n",
    "- \"keyword_embedding\"(not yet implemented)\n",
    "\n",
    "Here is the example on how to use `RetrieverQueryEngine` and `KnowledgeGraphRAGRetriever`:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from llama_index.core.query_engine import RetrieverQueryEngine\n",
    "from llama_index.core.retrievers import KnowledgeGraphRAGRetriever\n",
    "\n",
    "graph_rag_retriever = KnowledgeGraphRAGRetriever(\n",
    "    storage_context=storage_context,\n",
    "    verbose=True,\n",
    ")\n",
    "\n",
    "query_engine = RetrieverQueryEngine.from_args(\n",
    "    graph_rag_retriever,\n",
    ")"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Then we can query it like:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[32;1m\u001b[1;3mEntities processed: ['Star', 'Lord', 'Marvel', 'Quill', 'Galaxy', 'Guardians', 'Guardians of the Galaxy', 'Star-Lord', 'Peter Quill', 'Peter']\n",
      "\u001b[0m\u001b[32;1m\u001b[1;3mEntities processed: ['Star', 'Lord', 'Marvel', 'Quill', 'Galaxy', 'Guardians', 'Guardians of the Galaxy', 'Star-Lord', 'Peter Quill', 'Peter']\n",
      "\u001b[0m\u001b[36;1m\u001b[1;3mGraph RAG context:\n",
      "The following are knowledge sequence in max depth 2 in the form of `subject predicate, object, predicate_next_hop, object_next_hop ...` extracted based on key entities as subject:\n",
      "Guardians, is member of, Guardians, was experimented on, by the High Evolutionary\n",
      "Guardians, is member of, Guardians, considered to tell, origins\n",
      "Guardians, is member of, Guardians, origins, team-up movie\n",
      "Guardians, is member of, Guardians, befriended, his fellow Batch 89 test subjects\n",
      "Guardians, is member of, Guardians, sought to enhance and anthropomorphize animal lifeforms, to create an ideal society\n",
      "Guardians, is member of, Guardians, is creator of, Rocket\n",
      "Guardians, is member of, Guardians, is, Mantis\n",
      "Guardians, is member of, Guardians, is half-sister of, Mantis\n",
      "Guardians, is member of, Guardians, is, Kraglin\n",
      "Guardians, is member of, Guardians, developed psionic abilities, after being abandoned in outer space\n",
      "Guardians, is member of, Guardians, would portray, Cosmo\n",
      "Guardians, is member of, Guardians, recalls, his past\n",
      "Guardians, is member of, Guardians\n",
      "Guardians, is member of, Guardians, focus on, third Guardians-centric film\n",
      "Guardians, is member of, Guardians, is, Rocket\n",
      "Guardians, is member of, Guardians, backstory, flashbacks\n",
      "Guardians, is member of, Guardians, is former second-in-command of, Ravagers\n",
      "Quill, is half-sister of, Mantis, is member of, Guardians\n",
      "Quill, is half-sister of, Mantis, is, Mantis\n",
      "Quill, is in a state of depression, following the appearance of a variant of his dead lover Gamora\n",
      "Quill, is half-sister of, Mantis\n",
      "Peter Quill, is leader of, Guardians of the Galaxy, is sequel to, Guardians of the Galaxy\n",
      "Peter Quill, was raised by, a group of alien thieves and smugglers\n",
      "Peter Quill, would return to the MCU, May 2021\n",
      "Peter Quill, is leader of, Guardians of the Galaxy\n",
      "Peter Quill, is half-human, half-Celestial\n",
      "Peter Quill, was abducted from Earth, as a child\n",
      "Guardians of the Galaxy, is sequel to, Guardians of the Galaxy, released in, Dolby Cinema\n",
      "Guardians of the Galaxy, is sequel to, Guardians of the Galaxy, released on, Disney+\n",
      "Guardians of the Galaxy, is sequel to, Guardians of the Galaxy, is sequel to, Guardians of the Galaxy Vol. 2\n",
      "\u001b[0m"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "<b>\n",
       "\n",
       "Peter Quill is the leader of the Guardians of the Galaxy and the main protagonist of the Guardians of the Galaxy films. He was raised by a group of alien thieves and smugglers, and was abducted from Earth as a child. He is half-human, half-Celestial, and has the ability to wield an energy weapon called the Infinity Stone. He is set to return to the MCU in May 2021.</b>"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from IPython.display import display, Markdown\n",
    "\n",
    "response = query_engine.query(\n",
    "    \"Tell me about Peter Quill?\",\n",
    ")\n",
    "display(Markdown(f\"<b>{response}</b>\"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "INFO:openai:message='OpenAI API response' path=https://api.openai.com/v1/completions processing_ms=611 request_id=1c07a89e18f19ac7bbc508507c2902d9 response_code=200\n",
      "\u001b[32;1m\u001b[1;3mEntities processed: ['Star', 'Lord', 'Marvel', 'Quill', 'Galaxy', 'Guardians', 'Guardians of the Galaxy', 'Star-Lord', 'Peter Quill', 'Peter']\n",
      "\u001b[0mINFO:openai:message='OpenAI API response' path=https://api.openai.com/v1/completions processing_ms=992 request_id=6517cb63da3364acd33e816a9b3ee242 response_code=200\n",
      "\u001b[32;1m\u001b[1;3mEntities processed: ['Star', 'Lord', 'Marvel', 'Quill', 'Galaxy', 'Guardians', 'Guardians of the Galaxy', 'Star-Lord', 'Peter Quill', 'Peter']\n",
      "\u001b[0m\u001b[36;1m\u001b[1;3mGraph RAG context:\n",
      "The following are knowledge sequence in max depth 2 in the form of `subject predicate, object, predicate_next_hop, object_next_hop ...` extracted based on key entities as subject:\n",
      "Guardians, is member of, Guardians, was experimented on, by the High Evolutionary\n",
      "Guardians, is member of, Guardians, considered to tell, origins\n",
      "Guardians, is member of, Guardians, origins, team-up movie\n",
      "Guardians, is member of, Guardians, befriended, his fellow Batch 89 test subjects\n",
      "Guardians, is member of, Guardians, sought to enhance and anthropomorphize animal lifeforms, to create an ideal society\n",
      "Guardians, is member of, Guardians, is creator of, Rocket\n",
      "Guardians, is member of, Guardians, is, Mantis\n",
      "Guardians, is member of, Guardians, is half-sister of, Mantis\n",
      "Guardians, is member of, Guardians, is, Kraglin\n",
      "Guardians, is member of, Guardians, developed psionic abilities, after being abandoned in outer space\n",
      "Guardians, is member of, Guardians, would portray, Cosmo\n",
      "Guardians, is member of, Guardians, recalls, his past\n",
      "Guardians, is member of, Guardians\n",
      "Guardians, is member of, Guardians, focus on, third Guardians-centric film\n",
      "Guardians, is member of, Guardians, is, Rocket\n",
      "Guardians, is member of, Guardians, backstory, flashbacks\n",
      "Guardians, is member of, Guardians, is former second-in-command of, Ravagers\n",
      "Quill, is half-sister of, Mantis, is member of, Guardians\n",
      "Quill, is half-sister of, Mantis, is, Mantis\n",
      "Quill, is in a state of depression, following the appearance of a variant of his dead lover Gamora\n",
      "Quill, is half-sister of, Mantis\n",
      "Peter Quill, is leader of, Guardians of the Galaxy, is sequel to, Guardians of the Galaxy\n",
      "Peter Quill, was raised by, a group of alien thieves and smugglers\n",
      "Peter Quill, would return to the MCU, May 2021\n",
      "Peter Quill, is leader of, Guardians of the Galaxy\n",
      "Peter Quill, is half-human, half-Celestial\n",
      "Peter Quill, was abducted from Earth, as a child\n",
      "Guardians of the Galaxy, is sequel to, Guardians of the Galaxy, released in, Dolby Cinema\n",
      "Guardians of the Galaxy, is sequel to, Guardians of the Galaxy, released on, Disney+\n",
      "Guardians of the Galaxy, is sequel to, Guardians of the Galaxy, is sequel to, Guardians of the Galaxy Vol. 2\n",
      "\u001b[0mINFO:openai:message='OpenAI API response' path=https://api.openai.com/v1/completions processing_ms=2384 request_id=b5a7e601affa751fbc7f957f3359a238 response_code=200\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "<b>\n",
       "\n",
       "Peter Quill is the leader of the Guardians of the Galaxy and the main protagonist of the Guardians of the Galaxy films. He was raised by a group of alien thieves and smugglers, and was abducted from Earth as a child. He is half-human, half-Celestial, and has the ability to wield an energy weapon called the Infinity Stone. He is set to return to the MCU in May 2021.</b>"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "response = await query_engine.aquery(\n",
    "    \"Tell me about Peter Quill?\",\n",
    ")\n",
    "display(Markdown(f\"<b>{response}</b>\"))"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Include nl2graphquery as Context in Graph RAG\n",
    "\n",
    "The nature of (Sub)Graph RAG and nl2graphquery are different. No one is better than the other but just when one fits more in certain type of questions. To understand more on how they differ from the other, see [this demo](https://www.siwei.io/en/demos/graph-rag/) comparing the two.\n",
    "\n",
    "<video width=\"938\" height=\"800\" \n",
    "       src=\"https://github.com/siwei-io/talks/assets/1651790/05d01e53-d819-4f43-9bf1-75549f7f2be9\"  \n",
    "       controls>\n",
    "</video>\n",
    "\n",
    "While in real world cases, we may not always know which approach works better, thus, one way to best leverage KG in RAG are fetching both retrieval results as context and letting LLM + Prompt generate answer with them all being involved.\n",
    "\n",
    "So, optionally, we could choose to synthesise answer from two piece of retrieved context from KG:\n",
    "- Graph RAG, the default retrieval method, which extracts subgraph that's related to the key entities in the question.\n",
    "- NL2GraphQuery, generate Knowledge Graph Query based on query and the Schema of the Knowledge Graph, which is by default switched off.\n",
    "\n",
    "We could set `with_nl2graphquery=True` to enable it like:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "graph_rag_retriever_with_nl2graphquery = KnowledgeGraphRAGRetriever(\n",
    "    storage_context=storage_context,\n",
    "    verbose=True,\n",
    "    with_nl2graphquery=True,\n",
    ")\n",
    "\n",
    "query_engine_with_nl2graphquery = RetrieverQueryEngine.from_args(\n",
    "    graph_rag_retriever_with_nl2graphquery,\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[33;1m\u001b[1;3mGraph Store Query:\n",
      "```\n",
      "MATCH (p:`entity`)-[:`relationship`]->(m:`entity`) WHERE p.`entity`.`name` == 'Peter Quill'\n",
      "RETURN m.`entity`.`name`;\n",
      "```\n",
      "\u001b[0m\u001b[33;1m\u001b[1;3mGraph Store Response:\n",
      "{'m.entity.name': ['May 2021', 'as a child', 'Guardians of the Galaxy', 'a group of alien thieves and smugglers', 'half-Celestial']}\n",
      "\u001b[0m\u001b[32;1m\u001b[1;3mEntities processed: ['Star', 'Lord', 'Marvel', 'Quill', 'Galaxy', 'Guardians', 'Guardians of the Galaxy', 'Star-Lord', 'Peter Quill', 'Peter']\n",
      "\u001b[0m\u001b[32;1m\u001b[1;3mEntities processed: ['Star', 'Lord', 'Marvel', 'Quill', 'Galaxy', 'Guardians', 'Guardians of the Galaxy', 'Star-Lord', 'Peter Quill', 'Peter']\n",
      "\u001b[0m\u001b[36;1m\u001b[1;3mGraph RAG context:\n",
      "The following are knowledge sequence in max depth 2 in the form of `subject predicate, object, predicate_next_hop, object_next_hop ...` extracted based on key entities as subject:\n",
      "Guardians, is member of, Guardians, was experimented on, by the High Evolutionary\n",
      "Guardians, is member of, Guardians, considered to tell, origins\n",
      "Guardians, is member of, Guardians, origins, team-up movie\n",
      "Guardians, is member of, Guardians, befriended, his fellow Batch 89 test subjects\n",
      "Guardians, is member of, Guardians, sought to enhance and anthropomorphize animal lifeforms, to create an ideal society\n",
      "Guardians, is member of, Guardians, is creator of, Rocket\n",
      "Guardians, is member of, Guardians, is, Mantis\n",
      "Guardians, is member of, Guardians, is half-sister of, Mantis\n",
      "Guardians, is member of, Guardians, is, Kraglin\n",
      "Guardians, is member of, Guardians, developed psionic abilities, after being abandoned in outer space\n",
      "Guardians, is member of, Guardians, would portray, Cosmo\n",
      "Guardians, is member of, Guardians, recalls, his past\n",
      "Guardians, is member of, Guardians\n",
      "Guardians, is member of, Guardians, focus on, third Guardians-centric film\n",
      "Guardians, is member of, Guardians, is, Rocket\n",
      "Guardians, is member of, Guardians, backstory, flashbacks\n",
      "Guardians, is member of, Guardians, is former second-in-command of, Ravagers\n",
      "Quill, is half-sister of, Mantis, is member of, Guardians\n",
      "Quill, is half-sister of, Mantis, is, Mantis\n",
      "Quill, is in a state of depression, following the appearance of a variant of his dead lover Gamora\n",
      "Quill, is half-sister of, Mantis\n",
      "Peter Quill, is leader of, Guardians of the Galaxy, is sequel to, Guardians of the Galaxy\n",
      "Peter Quill, was raised by, a group of alien thieves and smugglers\n",
      "Peter Quill, would return to the MCU, May 2021\n",
      "Peter Quill, is leader of, Guardians of the Galaxy\n",
      "Peter Quill, is half-human, half-Celestial\n",
      "Peter Quill, was abducted from Earth, as a child\n",
      "Guardians of the Galaxy, is sequel to, Guardians of the Galaxy, released in, Dolby Cinema\n",
      "Guardians of the Galaxy, is sequel to, Guardians of the Galaxy, released on, Disney+\n",
      "Guardians of the Galaxy, is sequel to, Guardians of the Galaxy, is sequel to, Guardians of the Galaxy Vol. 2\n",
      "\u001b[0m"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "<b>\n",
       "\n",
       "Peter Quill is the leader of the Guardians of the Galaxy and was abducted from Earth as a child. He is half-human and half-Celestial, and was raised by a group of alien thieves and smugglers. He would return to the MCU in May 2021.</b>"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "response = query_engine_with_nl2graphquery.query(\n",
    "    \"What do you know about Peter Quill?\",\n",
    ")\n",
    "display(Markdown(f\"<b>{response}</b>\"))"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "And let's check the response's metadata to know more details of the retrival of Graph RAG with nl2graphquery by inspecting `response.metadata`.\n",
    "\n",
    "- **text2Cypher**, it generates a Cypher Query towards the answer as the context.\n",
    "\n",
    "```cypher\n",
    "Graph Store Query: MATCH (e:`entity`)-[r:`relationship`]->(e2:`entity`)\n",
    "WHERE e.`entity`.`name` == 'Peter Quill'\n",
    "RETURN e2.`entity`.`name`\n",
    "```\n",
    "- **SubGraph RAG**, it get the SubGraph of 'Peter Quill' to build the context.\n",
    "\n",
    "- Finally, it combined the two nodes of context, to synthesize the answer."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'46faf6d6-8a71-44c8-ae81-794e71a62fbc': {'graph_schema': 'Node properties: '\n",
      "                                                          \"[{'tag': 'entity', \"\n",
      "                                                          \"'properties': \"\n",
      "                                                          \"[('name', \"\n",
      "                                                          \"'string')]}]\\n\"\n",
      "                                                          'Edge properties: '\n",
      "                                                          \"[{'edge': \"\n",
      "                                                          \"'relationship', \"\n",
      "                                                          \"'properties': \"\n",
      "                                                          \"[('relationship', \"\n",
      "                                                          \"'string')]}]\\n\"\n",
      "                                                          'Relationships: '\n",
      "                                                          \"['(:entity)-[:relationship]->(:entity)']\\n\",\n",
      "                                          'graph_store_query': '```\\n'\n",
      "                                                               'MATCH '\n",
      "                                                               '(p:`entity`)-[:`relationship`]->(m:`entity`) '\n",
      "                                                               'WHERE '\n",
      "                                                               'p.`entity`.`name` '\n",
      "                                                               \"== 'Peter \"\n",
      "                                                               \"Quill'\\n\"\n",
      "                                                               'RETURN '\n",
      "                                                               'm.`entity`.`name`;\\n'\n",
      "                                                               '```',\n",
      "                                          'graph_store_response': {'m.entity.name': ['May '\n",
      "                                                                                     '2021',\n",
      "                                                                                     'as '\n",
      "                                                                                     'a '\n",
      "                                                                                     'child',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy',\n",
      "                                                                                     'a '\n",
      "                                                                                     'group '\n",
      "                                                                                     'of '\n",
      "                                                                                     'alien '\n",
      "                                                                                     'thieves '\n",
      "                                                                                     'and '\n",
      "                                                                                     'smugglers',\n",
      "                                                                                     'half-Celestial']},\n",
      "                                          'query_str': 'What do you know about '\n",
      "                                                       'Peter Quill?'},\n",
      " 'def19bbf-d8ac-43b2-a121-675748cc9454': {'kg_rel_map': {'Guardians': ['Guardians, '\n",
      "                                                                       'is '\n",
      "                                                                       'member '\n",
      "                                                                       'of, '\n",
      "                                                                       'Guardians, '\n",
      "                                                                       'was '\n",
      "                                                                       'experimented '\n",
      "                                                                       'on, by '\n",
      "                                                                       'the '\n",
      "                                                                       'High '\n",
      "                                                                       'Evolutionary',\n",
      "                                                                       'Guardians, '\n",
      "                                                                       'is '\n",
      "                                                                       'member '\n",
      "                                                                       'of, '\n",
      "                                                                       'Guardians, '\n",
      "                                                                       'considered '\n",
      "                                                                       'to '\n",
      "                                                                       'tell, '\n",
      "                                                                       'origins',\n",
      "                                                                       'Guardians, '\n",
      "                                                                       'is '\n",
      "                                                                       'member '\n",
      "                                                                       'of, '\n",
      "                                                                       'Guardians, '\n",
      "                                                                       'origins, '\n",
      "                                                                       'team-up '\n",
      "                                                                       'movie',\n",
      "                                                                       'Guardians, '\n",
      "                                                                       'is '\n",
      "                                                                       'member '\n",
      "                                                                       'of, '\n",
      "                                                                       'Guardians, '\n",
      "                                                                       'befriended, '\n",
      "                                                                       'his '\n",
      "                                                                       'fellow '\n",
      "                                                                       'Batch '\n",
      "                                                                       '89 '\n",
      "                                                                       'test '\n",
      "                                                                       'subjects',\n",
      "                                                                       'Guardians, '\n",
      "                                                                       'is '\n",
      "                                                                       'member '\n",
      "                                                                       'of, '\n",
      "                                                                       'Guardians, '\n",
      "                                                                       'sought '\n",
      "                                                                       'to '\n",
      "                                                                       'enhance '\n",
      "                                                                       'and '\n",
      "                                                                       'anthropomorphize '\n",
      "                                                                       'animal '\n",
      "                                                                       'lifeforms, '\n",
      "                                                                       'to '\n",
      "                                                                       'create '\n",
      "                                                                       'an '\n",
      "                                                                       'ideal '\n",
      "                                                                       'society',\n",
      "                                                                       'Guardians, '\n",
      "                                                                       'is '\n",
      "                                                                       'member '\n",
      "                                                                       'of, '\n",
      "                                                                       'Guardians, '\n",
      "                                                                       'is '\n",
      "                                                                       'creator '\n",
      "                                                                       'of, '\n",
      "                                                                       'Rocket',\n",
      "                                                                       'Guardians, '\n",
      "                                                                       'is '\n",
      "                                                                       'member '\n",
      "                                                                       'of, '\n",
      "                                                                       'Guardians, '\n",
      "                                                                       'is, '\n",
      "                                                                       'Mantis',\n",
      "                                                                       'Guardians, '\n",
      "                                                                       'is '\n",
      "                                                                       'member '\n",
      "                                                                       'of, '\n",
      "                                                                       'Guardians, '\n",
      "                                                                       'is '\n",
      "                                                                       'half-sister '\n",
      "                                                                       'of, '\n",
      "                                                                       'Mantis',\n",
      "                                                                       'Guardians, '\n",
      "                                                                       'is '\n",
      "                                                                       'member '\n",
      "                                                                       'of, '\n",
      "                                                                       'Guardians, '\n",
      "                                                                       'is, '\n",
      "                                                                       'Kraglin',\n",
      "                                                                       'Guardians, '\n",
      "                                                                       'is '\n",
      "                                                                       'member '\n",
      "                                                                       'of, '\n",
      "                                                                       'Guardians, '\n",
      "                                                                       'developed '\n",
      "                                                                       'psionic '\n",
      "                                                                       'abilities, '\n",
      "                                                                       'after '\n",
      "                                                                       'being '\n",
      "                                                                       'abandoned '\n",
      "                                                                       'in '\n",
      "                                                                       'outer '\n",
      "                                                                       'space',\n",
      "                                                                       'Guardians, '\n",
      "                                                                       'is '\n",
      "                                                                       'member '\n",
      "                                                                       'of, '\n",
      "                                                                       'Guardians, '\n",
      "                                                                       'would '\n",
      "                                                                       'portray, '\n",
      "                                                                       'Cosmo',\n",
      "                                                                       'Guardians, '\n",
      "                                                                       'is '\n",
      "                                                                       'member '\n",
      "                                                                       'of, '\n",
      "                                                                       'Guardians, '\n",
      "                                                                       'recalls, '\n",
      "                                                                       'his '\n",
      "                                                                       'past',\n",
      "                                                                       'Guardians, '\n",
      "                                                                       'is '\n",
      "                                                                       'member '\n",
      "                                                                       'of, '\n",
      "                                                                       'Guardians',\n",
      "                                                                       'Guardians, '\n",
      "                                                                       'is '\n",
      "                                                                       'member '\n",
      "                                                                       'of, '\n",
      "                                                                       'Guardians, '\n",
      "                                                                       'focus '\n",
      "                                                                       'on, '\n",
      "                                                                       'third '\n",
      "                                                                       'Guardians-centric '\n",
      "                                                                       'film',\n",
      "                                                                       'Guardians, '\n",
      "                                                                       'is '\n",
      "                                                                       'member '\n",
      "                                                                       'of, '\n",
      "                                                                       'Guardians, '\n",
      "                                                                       'is, '\n",
      "                                                                       'Rocket',\n",
      "                                                                       'Guardians, '\n",
      "                                                                       'is '\n",
      "                                                                       'member '\n",
      "                                                                       'of, '\n",
      "                                                                       'Guardians, '\n",
      "                                                                       'backstory, '\n",
      "                                                                       'flashbacks',\n",
      "                                                                       'Guardians, '\n",
      "                                                                       'is '\n",
      "                                                                       'member '\n",
      "                                                                       'of, '\n",
      "                                                                       'Guardians, '\n",
      "                                                                       'is '\n",
      "                                                                       'former '\n",
      "                                                                       'second-in-command '\n",
      "                                                                       'of, '\n",
      "                                                                       'Ravagers'],\n",
      "                                                         'Guardians of the Galaxy': ['Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'sequel '\n",
      "                                                                                     'to, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'released '\n",
      "                                                                                     'in, '\n",
      "                                                                                     'Dolby '\n",
      "                                                                                     'Cinema',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'sequel '\n",
      "                                                                                     'to, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'released '\n",
      "                                                                                     'on, '\n",
      "                                                                                     'Disney+',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'sequel '\n",
      "                                                                                     'to, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'sequel '\n",
      "                                                                                     'to, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy '\n",
      "                                                                                     'Vol. '\n",
      "                                                                                     '2',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'sequel '\n",
      "                                                                                     'to, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'released '\n",
      "                                                                                     'in, '\n",
      "                                                                                     '3D',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'sequel '\n",
      "                                                                                     'to, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'released '\n",
      "                                                                                     'in, '\n",
      "                                                                                     '4DX',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'sequel '\n",
      "                                                                                     'to, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'grossed, '\n",
      "                                                                                     '$32 '\n",
      "                                                                                     'million '\n",
      "                                                                                     'in '\n",
      "                                                                                     'its '\n",
      "                                                                                     'third '\n",
      "                                                                                     'weekend',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'leader '\n",
      "                                                                                     'of, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'sequel '\n",
      "                                                                                     'to, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'in, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy '\n",
      "                                                                                     'Vol. '\n",
      "                                                                                     '3',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'sequel '\n",
      "                                                                                     'to, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'sequel '\n",
      "                                                                                     'to, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'wrote '\n",
      "                                                                                     'and '\n",
      "                                                                                     'directed, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy '\n",
      "                                                                                     'Vol. '\n",
      "                                                                                     '3',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'sequel '\n",
      "                                                                                     'to, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is, '\n",
      "                                                                                     'American '\n",
      "                                                                                     'superhero '\n",
      "                                                                                     'film',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'sequel '\n",
      "                                                                                     'to, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'grossed, '\n",
      "                                                                                     '$845.4 '\n",
      "                                                                                     'million',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'sequel '\n",
      "                                                                                     'to, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'was '\n",
      "                                                                                     'fired '\n",
      "                                                                                     'from, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy '\n",
      "                                                                                     'Vol. '\n",
      "                                                                                     '3',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'leader '\n",
      "                                                                                     'of, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'was '\n",
      "                                                                                     'abducted '\n",
      "                                                                                     'from '\n",
      "                                                                                     'Earth, '\n",
      "                                                                                     'as '\n",
      "                                                                                     'a '\n",
      "                                                                                     'child',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'sequel '\n",
      "                                                                                     'to, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'grossed, '\n",
      "                                                                                     '$359 '\n",
      "                                                                                     'million '\n",
      "                                                                                     'in '\n",
      "                                                                                     'the '\n",
      "                                                                                     'United '\n",
      "                                                                                     'States '\n",
      "                                                                                     'and '\n",
      "                                                                                     'Canada',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'sequel '\n",
      "                                                                                     'to, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'released '\n",
      "                                                                                     'on, '\n",
      "                                                                                     'digital '\n",
      "                                                                                     'download',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'sequel '\n",
      "                                                                                     'to, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'released '\n",
      "                                                                                     'in, '\n",
      "                                                                                     'IMAX',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'leader '\n",
      "                                                                                     'of, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'half-human, '\n",
      "                                                                                     'half-Celestial',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'leader '\n",
      "                                                                                     'of, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'was '\n",
      "                                                                                     'raised '\n",
      "                                                                                     'by, '\n",
      "                                                                                     'a '\n",
      "                                                                                     'group '\n",
      "                                                                                     'of '\n",
      "                                                                                     'alien '\n",
      "                                                                                     'thieves '\n",
      "                                                                                     'and '\n",
      "                                                                                     'smugglers',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'sequel '\n",
      "                                                                                     'to, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'screened '\n",
      "                                                                                     'at, '\n",
      "                                                                                     'Dongdaemun '\n",
      "                                                                                     'Design '\n",
      "                                                                                     'Plaza',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'sequel '\n",
      "                                                                                     'to, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'released '\n",
      "                                                                                     'in, '\n",
      "                                                                                     'ScreenX',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'leader '\n",
      "                                                                                     'of, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'would '\n",
      "                                                                                     'return '\n",
      "                                                                                     'to '\n",
      "                                                                                     'the '\n",
      "                                                                                     'MCU, '\n",
      "                                                                                     'May '\n",
      "                                                                                     '2021',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'sequel '\n",
      "                                                                                     'to, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'grossed, '\n",
      "                                                                                     '$486.4 '\n",
      "                                                                                     'million '\n",
      "                                                                                     'in '\n",
      "                                                                                     'other '\n",
      "                                                                                     'territories',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'sequel '\n",
      "                                                                                     'to, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'released '\n",
      "                                                                                     'on, '\n",
      "                                                                                     'Ultra '\n",
      "                                                                                     'HD '\n",
      "                                                                                     'Blu-ray',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'sequel '\n",
      "                                                                                     'to, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'released '\n",
      "                                                                                     'on, '\n",
      "                                                                                     'DVD',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'sequel '\n",
      "                                                                                     'to, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'grossed, '\n",
      "                                                                                     '$92 '\n",
      "                                                                                     'million '\n",
      "                                                                                     'for '\n",
      "                                                                                     'a '\n",
      "                                                                                     'drop '\n",
      "                                                                                     'of '\n",
      "                                                                                     '40% '\n",
      "                                                                                     'from '\n",
      "                                                                                     'its '\n",
      "                                                                                     'opening '\n",
      "                                                                                     'weekend',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'sequel '\n",
      "                                                                                     'to, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'premiered '\n",
      "                                                                                     'at, '\n",
      "                                                                                     'Disneyland '\n",
      "                                                                                     'Paris',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'sequel '\n",
      "                                                                                     'to, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'released '\n",
      "                                                                                     'on, '\n",
      "                                                                                     'Blu-ray',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'sequel '\n",
      "                                                                                     'to, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'could '\n",
      "                                                                                     'happen, '\n",
      "                                                                                     'April '\n",
      "                                                                                     '2017',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'sequel '\n",
      "                                                                                     'to, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'made, '\n",
      "                                                                                     '$48.2 '\n",
      "                                                                                     'million '\n",
      "                                                                                     'on '\n",
      "                                                                                     'its '\n",
      "                                                                                     'first '\n",
      "                                                                                     'day',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'sequel '\n",
      "                                                                                     'to, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'grossed, '\n",
      "                                                                                     '$168.1 '\n",
      "                                                                                     'million '\n",
      "                                                                                     'in '\n",
      "                                                                                     'its '\n",
      "                                                                                     'opening '\n",
      "                                                                                     'weekend',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'sequel '\n",
      "                                                                                     'to, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'debuted '\n",
      "                                                                                     'with, '\n",
      "                                                                                     '$118.4 '\n",
      "                                                                                     'million',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'sequel '\n",
      "                                                                                     'to, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'would '\n",
      "                                                                                     'likely '\n",
      "                                                                                     'center '\n",
      "                                                                                     'on, '\n",
      "                                                                                     'new '\n",
      "                                                                                     'group '\n",
      "                                                                                     'of '\n",
      "                                                                                     'characters',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'sequel '\n",
      "                                                                                     'to, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'retained '\n",
      "                                                                                     'the '\n",
      "                                                                                     'top '\n",
      "                                                                                     'spot '\n",
      "                                                                                     'at '\n",
      "                                                                                     'the '\n",
      "                                                                                     'box '\n",
      "                                                                                     'office '\n",
      "                                                                                     'with, '\n",
      "                                                                                     '$62 '\n",
      "                                                                                     'million',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'sequel '\n",
      "                                                                                     'to, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'be '\n",
      "                                                                                     'his '\n",
      "                                                                                     'last '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'film, '\n",
      "                                                                                     'September '\n",
      "                                                                                     '2019',\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'is '\n",
      "                                                                                     'sequel '\n",
      "                                                                                     'to, '\n",
      "                                                                                     'Guardians '\n",
      "                                                                                     'of '\n",
      "                                                                                     'the '\n",
      "                                                                                     'Galaxy, '\n",
      "                                                                                     'nominated '\n",
      "                                                                                     'for, '\n",
      "                                                                                     'Best '\n",
      "                                                                                     'Picture'],\n",
      "                                                         'Marvel': ['Marvel, '\n",
      "                                                                    'was fired '\n",
      "                                                                    'from, '\n",
      "                                                                    'Marvel, '\n",
      "                                                                    'stated, '\n",
      "                                                                    'that in '\n",
      "                                                                    'addition '\n",
      "                                                                    'to having '\n",
      "                                                                    'the  '\n",
      "                                                                    'basic '\n",
      "                                                                    'story  '\n",
      "                                                                    'for '\n",
      "                                                                    'Guardians '\n",
      "                                                                    'of the '\n",
      "                                                                    'Galaxy '\n",
      "                                                                    'Vol.2 '\n",
      "                                                                    '(2017) '\n",
      "                                                                    'while '\n",
      "                                                                    'working '\n",
      "                                                                    'on the '\n",
      "                                                                    'first '\n",
      "                                                                    'film',\n",
      "                                                                    'Marvel, '\n",
      "                                                                    'was fired '\n",
      "                                                                    'from, '\n",
      "                                                                    'Marvel, '\n",
      "                                                                    'was '\n",
      "                                                                    'unsure, '\n",
      "                                                                    'if he '\n",
      "                                                                    'would be '\n",
      "                                                                    'involved '\n",
      "                                                                    'with a '\n",
      "                                                                    'third '\n",
      "                                                                    'Guardians '\n",
      "                                                                    'film',\n",
      "                                                                    'Marvel, '\n",
      "                                                                    'was fired '\n",
      "                                                                    'from, '\n",
      "                                                                    'Marvel, '\n",
      "                                                                    'was '\n",
      "                                                                    'privately '\n",
      "                                                                    'notified '\n",
      "                                                                    'by, Horn',\n",
      "                                                                    'Marvel, '\n",
      "                                                                    'was fired '\n",
      "                                                                    'from, '\n",
      "                                                                    'Marvel, '\n",
      "                                                                    'was fired '\n",
      "                                                                    'from, '\n",
      "                                                                    'Guardians '\n",
      "                                                                    'of the '\n",
      "                                                                    'Galaxy '\n",
      "                                                                    'Vol. 3',\n",
      "                                                                    'Marvel, '\n",
      "                                                                    'was fired '\n",
      "                                                                    'from, '\n",
      "                                                                    'Marvel',\n",
      "                                                                    'Marvel, '\n",
      "                                                                    'was fired '\n",
      "                                                                    'from, '\n",
      "                                                                    'Marvel, '\n",
      "                                                                    'wrote and '\n",
      "                                                                    'directed, '\n",
      "                                                                    'Guardians '\n",
      "                                                                    'of the '\n",
      "                                                                    'Galaxy '\n",
      "                                                                    'Vol. 3',\n",
      "                                                                    'Marvel, '\n",
      "                                                                    'was fired '\n",
      "                                                                    'from, '\n",
      "                                                                    'Marvel, '\n",
      "                                                                    'was fired '\n",
      "                                                                    'from, '\n",
      "                                                                    'Disney',\n",
      "                                                                    'Marvel, '\n",
      "                                                                    'was fired '\n",
      "                                                                    'from, '\n",
      "                                                                    'Marvel, '\n",
      "                                                                    'could '\n",
      "                                                                    'return as '\n",
      "                                                                    'director '\n",
      "                                                                    'for, '\n",
      "                                                                    'Vol.3'],\n",
      "                                                         'Peter Quill': ['Peter '\n",
      "                                                                         'Quill, '\n",
      "                                                                         'is '\n",
      "                                                                         'leader '\n",
      "                                                                         'of, '\n",
      "                                                                         'Guardians '\n",
      "                                                                         'of '\n",
      "                                                                         'the '\n",
      "                                                                         'Galaxy, '\n",
      "                                                                         'is '\n",
      "                                                                         'sequel '\n",
      "                                                                         'to, '\n",
      "                                                                         'Guardians '\n",
      "                                                                         'of '\n",
      "                                                                         'the '\n",
      "                                                                         'Galaxy',\n",
      "                                                                         'Peter '\n",
      "                                                                         'Quill, '\n",
      "                                                                         'was '\n",
      "                                                                         'raised '\n",
      "                                                                         'by, '\n",
      "                                                                         'a '\n",
      "                                                                         'group '\n",
      "                                                                         'of '\n",
      "                                                                         'alien '\n",
      "                                                                         'thieves '\n",
      "                                                                         'and '\n",
      "                                                                         'smugglers',\n",
      "                                                                         'Peter '\n",
      "                                                                         'Quill, '\n",
      "                                                                         'would '\n",
      "                                                                         'return '\n",
      "                                                                         'to '\n",
      "                                                                         'the '\n",
      "                                                                         'MCU, '\n",
      "                                                                         'May '\n",
      "                                                                         '2021',\n",
      "                                                                         'Peter '\n",
      "                                                                         'Quill, '\n",
      "                                                                         'is '\n",
      "                                                                         'leader '\n",
      "                                                                         'of, '\n",
      "                                                                         'Guardians '\n",
      "                                                                         'of '\n",
      "                                                                         'the '\n",
      "                                                                         'Galaxy',\n",
      "                                                                         'Peter '\n",
      "                                                                         'Quill, '\n",
      "                                                                         'is '\n",
      "                                                                         'half-human, '\n",
      "                                                                         'half-Celestial',\n",
      "                                                                         'Peter '\n",
      "                                                                         'Quill, '\n",
      "                                                                         'was '\n",
      "                                                                         'abducted '\n",
      "                                                                         'from '\n",
      "                                                                         'Earth, '\n",
      "                                                                         'as a '\n",
      "                                                                         'child'],\n",
      "                                                         'Quill': ['Quill, is '\n",
      "                                                                   'half-sister '\n",
      "                                                                   'of, '\n",
      "                                                                   'Mantis, is '\n",
      "                                                                   'member of, '\n",
      "                                                                   'Guardians',\n",
      "                                                                   'Quill, is '\n",
      "                                                                   'half-sister '\n",
      "                                                                   'of, '\n",
      "                                                                   'Mantis, '\n",
      "                                                                   'is, Mantis',\n",
      "                                                                   'Quill, is '\n",
      "                                                                   'in a state '\n",
      "                                                                   'of '\n",
      "                                                                   'depression, '\n",
      "                                                                   'following '\n",
      "                                                                   'the '\n",
      "                                                                   'appearance '\n",
      "                                                                   'of a '\n",
      "                                                                   'variant of '\n",
      "                                                                   'his dead '\n",
      "                                                                   'lover '\n",
      "                                                                   'Gamora',\n",
      "                                                                   'Quill, is '\n",
      "                                                                   'half-sister '\n",
      "                                                                   'of, '\n",
      "                                                                   'Mantis']},\n",
      "                                          'kg_rel_text': ['Guardians, is '\n",
      "                                                          'member of, '\n",
      "                                                          'Guardians, was '\n",
      "                                                          'experimented on, by '\n",
      "                                                          'the High '\n",
      "                                                          'Evolutionary',\n",
      "                                                          'Guardians, is '\n",
      "                                                          'member of, '\n",
      "                                                          'Guardians, '\n",
      "                                                          'considered to tell, '\n",
      "                                                          'origins',\n",
      "                                                          'Guardians, is '\n",
      "                                                          'member of, '\n",
      "                                                          'Guardians, origins, '\n",
      "                                                          'team-up movie',\n",
      "                                                          'Guardians, is '\n",
      "                                                          'member of, '\n",
      "                                                          'Guardians, '\n",
      "                                                          'befriended, his '\n",
      "                                                          'fellow Batch 89 '\n",
      "                                                          'test subjects',\n",
      "                                                          'Guardians, is '\n",
      "                                                          'member of, '\n",
      "                                                          'Guardians, sought '\n",
      "                                                          'to enhance and '\n",
      "                                                          'anthropomorphize '\n",
      "                                                          'animal lifeforms, '\n",
      "                                                          'to create an ideal '\n",
      "                                                          'society',\n",
      "                                                          'Guardians, is '\n",
      "                                                          'member of, '\n",
      "                                                          'Guardians, is '\n",
      "                                                          'creator of, Rocket',\n",
      "                                                          'Guardians, is '\n",
      "                                                          'member of, '\n",
      "                                                          'Guardians, is, '\n",
      "                                                          'Mantis',\n",
      "                                                          'Guardians, is '\n",
      "                                                          'member of, '\n",
      "                                                          'Guardians, is '\n",
      "                                                          'half-sister of, '\n",
      "                                                          'Mantis',\n",
      "                                                          'Guardians, is '\n",
      "                                                          'member of, '\n",
      "                                                          'Guardians, is, '\n",
      "                                                          'Kraglin',\n",
      "                                                          'Guardians, is '\n",
      "                                                          'member of, '\n",
      "                                                          'Guardians, '\n",
      "                                                          'developed psionic '\n",
      "                                                          'abilities, after '\n",
      "                                                          'being abandoned in '\n",
      "                                                          'outer space',\n",
      "                                                          'Guardians, is '\n",
      "                                                          'member of, '\n",
      "                                                          'Guardians, would '\n",
      "                                                          'portray, Cosmo',\n",
      "                                                          'Guardians, is '\n",
      "                                                          'member of, '\n",
      "                                                          'Guardians, recalls, '\n",
      "                                                          'his past',\n",
      "                                                          'Guardians, is '\n",
      "                                                          'member of, '\n",
      "                                                          'Guardians',\n",
      "                                                          'Guardians, is '\n",
      "                                                          'member of, '\n",
      "                                                          'Guardians, focus '\n",
      "                                                          'on, third '\n",
      "                                                          'Guardians-centric '\n",
      "                                                          'film',\n",
      "                                                          'Guardians, is '\n",
      "                                                          'member of, '\n",
      "                                                          'Guardians, is, '\n",
      "                                                          'Rocket',\n",
      "                                                          'Guardians, is '\n",
      "                                                          'member of, '\n",
      "                                                          'Guardians, '\n",
      "                                                          'backstory, '\n",
      "                                                          'flashbacks',\n",
      "                                                          'Guardians, is '\n",
      "                                                          'member of, '\n",
      "                                                          'Guardians, is '\n",
      "                                                          'former '\n",
      "                                                          'second-in-command '\n",
      "                                                          'of, Ravagers',\n",
      "                                                          'Quill, is '\n",
      "                                                          'half-sister of, '\n",
      "                                                          'Mantis, is member '\n",
      "                                                          'of, Guardians',\n",
      "                                                          'Quill, is '\n",
      "                                                          'half-sister of, '\n",
      "                                                          'Mantis, is, Mantis',\n",
      "                                                          'Quill, is in a '\n",
      "                                                          'state of '\n",
      "                                                          'depression, '\n",
      "                                                          'following the '\n",
      "                                                          'appearance of a '\n",
      "                                                          'variant of his dead '\n",
      "                                                          'lover Gamora',\n",
      "                                                          'Quill, is '\n",
      "                                                          'half-sister of, '\n",
      "                                                          'Mantis',\n",
      "                                                          'Peter Quill, is '\n",
      "                                                          'leader of, '\n",
      "                                                          'Guardians of the '\n",
      "                                                          'Galaxy, is sequel '\n",
      "                                                          'to, Guardians of '\n",
      "                                                          'the Galaxy',\n",
      "                                                          'Peter Quill, was '\n",
      "                                                          'raised by, a group '\n",
      "                                                          'of alien thieves '\n",
      "                                                          'and smugglers',\n",
      "                                                          'Peter Quill, would '\n",
      "                                                          'return to the MCU, '\n",
      "                                                          'May 2021',\n",
      "                                                          'Peter Quill, is '\n",
      "                                                          'leader of, '\n",
      "                                                          'Guardians of the '\n",
      "                                                          'Galaxy',\n",
      "                                                          'Peter Quill, is '\n",
      "                                                          'half-human, '\n",
      "                                                          'half-Celestial',\n",
      "                                                          'Peter Quill, was '\n",
      "                                                          'abducted from '\n",
      "                                                          'Earth, as a child',\n",
      "                                                          'Guardians of the '\n",
      "                                                          'Galaxy, is sequel '\n",
      "                                                          'to, Guardians of '\n",
      "                                                          'the Galaxy, '\n",
      "                                                          'released in, Dolby '\n",
      "                                                          'Cinema',\n",
      "                                                          'Guardians of the '\n",
      "                                                          'Galaxy, is sequel '\n",
      "                                                          'to, Guardians of '\n",
      "                                                          'the Galaxy, '\n",
      "                                                          'released on, '\n",
      "                                                          'Disney+',\n",
      "                                                          'Guardians of the '\n",
      "                                                          'Galaxy, is sequel '\n",
      "                                                          'to, Guardians of '\n",
      "                                                          'the Galaxy, is '\n",
      "                                                          'sequel to, '\n",
      "                                                          'Guardians of the '\n",
      "                                                          'Galaxy Vol. 2']}}\n"
     ]
    }
   ],
   "source": [
    "import pprint\n",
    "\n",
    "pp = pprint.PrettyPrinter()\n",
    "pp.pprint(response.metadata)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
